<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="description" content="Description">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
  <link rel="stylesheet" href="./vendor/themes/vue.css">
  <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify@4.13.1/themes/dolphin.css"> -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-xpost/docsify-xpost.css">
  <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/LIGMATV/docsify-theme-98@latest/98.css"> -->
  <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/LIGMATV/docsify-theme-xp@latest/xp.css"> -->
  <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/LIGMATV/docsify-theme-vista@latest/vista.css"> -->
  <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-darklight-theme@latest/dist/style.min.css"  /> -->
  <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/A5yncX/docsify-theme-darcula@v1.0/darcula.css"> -->
  <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sushantrahate/docsify-darkly-theme/css/darkly.css"> -->
  <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify/themes/dark.css" /> -->
  <!-- Theme: Defaults -->
  <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-defaults.css"> -->
  <!-- Theme: Simple -->
  <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple.css"> -->
  <!-- Theme: Simple Dark -->
  <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple-dark.css"> -->
  <!-- <link rel="stylesheet" href="./vendor/themes/github.css"> -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@sujaykumarh/docsify-plugin-footer@1.x/dist/plugin.min.css">
  <link rel="stylesheet" href="./vendor/themes/page.css">
  <link rel="stylesheet"
    href="https://cdn.jsdelivr.net/npm/@markbattistella/docsify-charty@latest/dist/docsify-charty.css">
    <link rel="stylesheet" href="./assets/lib/layui@2.11.4/css/layui.css">

  <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-versioned-plugin@0.0.1/styles.css"> -->

</head>

<body>
  <div id="app"></div>
  <script>
    window.$docsify = {
      auto2top: true,
      tabs: {
        persist: true, // default
        sync: false, // default
        theme: 'classic', // default
        tabComments: true, // default
        tabHeadings: true // default
      },
      customPageFooter: {
        debug: false,                   // for debugging

        showPoweredBy: false,            // should show powered by docsify at right
        copyrightYear: '',              // show copyright year, default current year.
        showCopyright: true,            // set to false to hide default copyright
        copyright: undefined,           // set this to html string to use custom copyrihgt section
        copyrightOwnerName: ' NEUQ 汤洛小组 ',         // copyright owner name
        copyrightOwnerLink: "https://gitee.com/cthree2004",  // copyright owner link if any
        copyrightExtra: "From NEUQ",      // any exta text to show below copyright owner section

        useLocalStorage: false,          // build and store footer in localstorage for quick access
      },
      mermaidConfig: {
        querySelector: ".mermaid",
        theme: "dark",
      },
      mermaidZoom: {
        minimumScale: 1,
        maximumScale: 10,
        zoomPannel: true
      },
      // themeColor: 'var(--mb-colour-pink)',
      progress: {
        position: "button",
        height: "5px",
      },
      charty: {
        "theme": "#8b8bff",
        "mode": "light"
      },
      chat: {
        // chat panel title
        title: "Dialog",
        // set avatar url
        users: [
          { nickname: "Yuki", avatar: "" },
          { nickname: "Robot", avatar: "" },
        ],
        self: "Yuki",
        animation: 500,
        os: "windows",
      },
      executeScript: true,
      // hideSidebar: true,
      // versions: [
      //   { folder: './', label: 'v2.0.0', default: true },
      //   { folder: 'v1', label: 'v1.0.0', default: false }
      // ],
      // versionSelectorLabel: 'Version',

      name: 'my docs',
      repo: '',
      // executeScript: true,
      loadNavbar: true,
      // loadSidebar: true,
      logo: '//losu.tech/index-new/images/losu-logo.svg',
      onlyCover: true,
      coverpage: true,
      'flexible-alerts': {
        style: 'flat',
        // style: 'callout',
      },
      markdown: {
        smartypants: true,
        renderer: {
          code: function (code, lang) {
            if (lang === "losu") {
              console.log('losu');
              const container = document.createElement('div');
              container.className = 'losu-code-container';
              // block.parentNode.insertBefore(container, block);
              // container.appendChild(block);

              // 创建运行按钮
              // const runButton = document.createElement('div');
              // runButton.className = 'losu-run-button';
              // runButton.textContent = '▶ 运行代码';
              // runButton.click = "alert(" + JSON.stringify(code) + ")";
              container.innerHTML += `<div class='losu-run-button' onclick='executeLosuCode(${JSON.stringify(code)})' >▶ 运行</div>`


              // 创建输出区域
              // const outputArea = document.createElement('pre');
              // outputArea.className = 'losu-output';
              // outputArea.style.display = 'block';

              // 添加到容器中
              // container.appendChild(runButton);
              container.innerHTML += this.origin.code.apply(this, arguments);
              // container.appendChild(outputArea);
              // container.innerHTML += `<pre> hello world <pre>`
              return container.outerHTML;
            }
            return this.origin.code.apply(this, arguments);
          }
        }
      }
    }
  </script>
  <!-- Docsify v4 -->
  <script src="./vendor/docsify.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/d3@7"></script>
  <script src="https://cdn.jsdelivr.net/npm/docsify-terminal-block@1.0.3"></script>
  <script src="https://cdn.jsdelivr.net/npm/docsify-xpost/docsify-xpost.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/@sujaykumarh/docsify-plugin-footer@1.x/dist/plugin.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/docsify/lib/plugins/external-script.min.js"></script>
  <script src="https://unpkg.com/docsify-plugin-flexible-alerts"></script>

  <script src="https://cdn.jsdelivr.net/npm/docsify-progress@latest/dist/progress.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/emoji.min.js"></script>
  <!-- <script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/zoom-image.min.js"></script> -->
  <!-- Import Mermaid -->
  <script type="module">
    import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs";
    mermaid.initialize({ startOnLoad: true });
    window.mermaid = mermaid;
  </script>
  <!-- Import Docsify-mermaid-zoom -->
  <script src="https://unpkg.com/docsify-mermaid@2.0.0/dist/docsify-mermaid.js"></script>
  <script src="https://unpkg.com/docsify-mermaid-zoom/dist/docsify-mermaid-zoom.js"></script>
  <script src="./vendor/chat.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/@markbattistella/docsify-charty@latest"></script>


  <!-- Latest v2.x.x -->
  <!-- <script src="https://unpkg.com/docsify-copy-code@2"></script> -->
  <script src="./losu.js"></script>
  <link rel="stylesheet" href="losu.css">
  <script>
    // 执行 losu 代码的函数（示例实现）
    function executeLosuCode(code) {
      const newWindow = window.open(
        "show.html",
        "_blank",//新的窗口打开
        `width=1200, height=750, menubar=no, toolbar=no, location=no, status=no, resizable=no`//配置项
      );
      const timer = setInterval(() => {
        if (newWindow.loaded) {
          clearInterval(timer);
          newWindow.postMessage({
            type: 'executeCode',
            code: code
          }, '*');
        }
      }, 100);
      // alert(code);
    }

    // 添加样式
    const style = document.createElement('style');
    style.textContent = `
        .losu-code-container {
            position: relative;
            margin: 1em 0;
        }
        
        .losu-run-button {
            border: none;
            padding: 8px 16px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 14px;
            margin: 4px 2px;
            cursor: pointer;
            border-radius: 4px;
            transition: background-color 0.3s;
        }
        
        .losu-run-button:hover {
            background-color: #45a049;
        }
        
        .losu-run-button:active {
            background-color: #3d8b40;
        }
        
        .losu-output {
            background-color: #f5f5f5;
            border: 1px solid #ddd;
            padding: 10px;
            margin: 10px 0;
            border-radius: 4px;
            font-family: monospace;
            white-space: pre-wrap;
            max-height: 200px;
            overflow-y: auto;
        }
        
        .losu-output.success {
            border-left: 4px solid #4CAF50;
        }
        
        .losu-output.error {
            border-left: 4px solid #f44336;
            background-color: #ffebee;
        }
    `;
    // document.head.appendChild(style);
  </script>
  <script src="https://cdn.jsdelivr.net/npm/docsify/lib/plugins/search.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/docsify-tabs@1"></script>
  <!-- <script src="https://cdn.jsdelivr.net/npm/docsify-darklight-theme@latest/dist/index.min.js" type="text/javascript"> -->
  </script>
</body>

</html>